<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>会员收货地址新增页  - ${web.name}${web.additionalTitle!}</title>
<link href="${root}/u/css/main.css" type="text/css" rel="stylesheet" />
<link href="${root}/u/css/memeber.css" type="text/css" rel="stylesheet" />
<link href="${sysResRoot}/front.css" rel="stylesheet" type="text/css"/>
<script src="${sysResRoot}/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
//获得城市
function getResultCity(d){
$.post('findAllCity.jspx', {"id":d}, 
function(data) {
if(data.success){
$("#itemcity").html("");
var select="<select name='cityId' onchange='getResultCountry(this.value)'>";
for(var i=0;i<data.ids.length;i++){
select+="<option value='"+data.ids[i]+"'>&nbsp;"+data.citys[i]+"&nbsp;</option>";
}
select+="</select>";
getResultCountry(data.ids[0]);
$("#itemcity").append(select);
} 
},"json");
}
//获得县、区
function getResultCountry(a){
	$.post('findAllCountry.jspx', {"id":a},
		 function(data) {
				if(data.success){
					$("#itemarea").html("");
                     var select="<select name='countryId'>";
                      for(var i=0;i<data.ids.length;i++){
              				select+="<option value='"+data.ids[i]+"'>&nbsp;"+data.areas[i]+"&nbsp;</option>";
              		 }
              		select+="</select>";
              		$("#itemarea").append(select);
				} 
		},"json");
}

function checkSubmit(){
	if($("#provinceId").val()==''||$("#provinceId").val()==null){
           alert("请选择所在地址!");
           return;
	}
	if($("#tel").val()==null&&$("#phone").val()==null&&$("#tel").val()==''&&$("#phone").val()==''){
        alert("手机跟电话至少有一项必填");
        return;
	}
	$("#jvForm").submit();
}
</script>
</head>
<body>
[#include "../include/会员中心页头顶栏.html"/]
<div class="w1168">
	[#include "会员中心_导航.html"/]
	<div id="container" class="user_right">
    <div class="user_title_r">
        <div class="user_title_l">收货地址<!--  <a href="${base}/customerService/add.jspx?storeId=${storeId!}" target="_self">添加</a> --></div>
    </div>   
    <div class="clear20"></div>    
	<!--
    <div class="columnright">
       <h3>现在的收货地址</h3>
	-->
	
	   
     <div>&nbsp;&nbsp;<b>新增地址</b><font color="red">（手机、固定电话选填一项，其余均为必填）</font></div>
      <form action="address_save.jspx" id="jvForm" method="post">
        <table width="100%" border="0" cellspacing="1" cellpadding="2">
           <tr>
              <td height="40" width="70" align="right" style="color:#333;">收货人：</td>
             <td><input name="username" type="text" maxlength="20" class="address_input required" /></td>
           </tr>
           <tr>
              <td height="40" align="right" style="color:#333;">性别：</td>
              <td><input type="radio" name="gender" value="true" checked/>男&nbsp;&nbsp;&nbsp;&nbsp;
		       <input type="radio" name="gender" value="false"/>女
             </td>
           </tr>
           <tr>
              <td height="40" align="right" style="color:#333;">所在地址：</td>
              <td>
                <select id="provinceId" name="provinceId" onchange="getResultCity(this.value)" style="border:1px solid #ccc;">
	                <option value="">--请选择--</option>
	                 [#list plist as province]
		               <option value="${province.id!}">${province.name!}</option>
                   	[/#list]
              </select>
              <span id="itemcity"></span>
              <span id="itemarea"></span>
              <!--  
              <a target="_blank" href="http://www.yihaodian.com/cms/view.do?topicId=13735&type=3">了解具体的配送范围 </a>
              -->
           </td>
           </tr>
           <tr>
              <td height="40" align="right" style="color:#333;">详细地址：</td>
             <td><input name="detailaddress" type="text" size="50" maxlength="100" class="address_input required"/></td>
           </tr>
            <tr>
              <td height="40" align="right" style="color:#333;">邮政编码：</td>
              <td><input name="postCode"  type="text" maxlength="15" class="address_input required"/></td>
           </tr>
           <tr>
              <td height="40" align="right" style="color:#333;">手机：</td>
             <td> <input type="text" id="tel"  name="tel"  maxlength="11" class="address_input digits"/>&nbsp;手机跟电话至少有一项必填  </td>
           </tr>
           <tr>
              <td height="40" align="right" style="color:#333;">固定电话：</td>
              <td><input type="text"  id="areaCode" name="areaCode" size="4"  maxlength="4" class="dzinput"/>-
		          <input type="text" id="phone" name="phone"  size="14" maxlength="10" class="dzinput"/>-
		          <input  type="text" id="extNumber" name="extNumber"  size="6"  maxlength="6" class="dzinput"/>
&nbsp;区号(3到4位数字，可选)-电话号码(7到8位数字)-分机号(最多6位数字，可选)</td>
           </tr>
           <tr>
              <td height="40" align="right" >&nbsp;</td>
             <td><input name="isDefault" type="checkbox" value="false" />设为默认地址</td>
           </tr>
           <tr>
              <td height="40" align="right" >&nbsp;</td>
              <td>
              <input type="button" value="保&nbsp;存 " class="menu_ok" onclick="checkSubmit();" />&nbsp;&nbsp;
		      <input type="reset" value="重&nbsp;置" class="menu_ok" /></td>
           </tr>
       </table>
    </form>
    
    
    <div class="clear10"></div><div class="clear10"></div>
    <ul class="address">
		  [#list list as address]
             <li [#if address.isDefault]class="current"[/#if]>
                 <s>${address_index+1}</s>
                 <div class="fr">
                     <a href="address_delete.jspx?id=${address.id}" class="menu_del">
                     <div class="menu_del"></div>
                     </a>
                     <div style=" margin-top:90px;">
                     	<div class="clear"></div>
                        <a href="address_default.jspx?id=${address.id}" style="color:#005ea7;">设为默认</a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="address_edit.jspx?id=${address.id}" style="color:#005ea7;">修改</a>
                     </div>
                 </div>
                 
                 <em>收货人：</em><span>${address.username!}</span><br />
                 <em>所在地区：</em><span>${address.country.name!}   ${address.province.name!}  ${address.city.name!}</span><br />
                 <em>详细地址：</em><span>${address.detailaddress!}</span><br />
                 <em>邮编：</em><span>${address.postCode!}</span><br />
                 <em>手机：</em><span>${address.tel!}</span>
             
             </li>     
          [/#list]
		</ul>
	</div>
	<div class="clear20"></div>
</div>
[#include "../include/页脚信息栏.html"/]
</body>
</html>